package tests;

import com.baomidou.lock.DefaultLockKeyBuilder;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.stereotype.Component;


/**
 * 自定义锁key生成器。
 * 默认的锁key生成器为 com.baomidou.lock.DefaultLockKeyBuilder
 */
@Component
public class MyLockKeyBuilder extends DefaultLockKeyBuilder {

    public MyLockKeyBuilder(BeanFactory beanFactory) {
        super(beanFactory);
    }

    @Override
    public String buildKey(MethodInvocation invocation, String[] definitionKeys) {
        String key = super.buildKey(invocation, definitionKeys);
        // do something
        return key;
    }
}